package com.ymatou.iapi.login.testcase;

import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.login.parameter.ThirdpartyLoginBean;
import com.ymatou.iapi.login.parameter.GetLoginAuthParamsBean;
import com.ymatou.iapi.login.service.ThirdpartyLoginCall;
import com.ymatou.iapi.login.service.GetLoginAuthParamsCall;
import com.ymatou.iapi.login.service.GetLoginAuthParamsCall;
import com.ymatou.iapi.login.service.LoginAuthCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.userservice.parameter.enums.ThirdPartyTypeEnum;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.constant.ECode;
import com.ymttest.utils.constant.ThirdPartyType;
/**
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetLoginAuthParams{
	private static GetLoginAuthParamsBean GetLoginAuthParamsBean;
	private static GetLoginAuthParamsCall GetLoginAuthParamsCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("支付宝APP快速登录请求授权");
	}

	@Before
	public void caseUp() {
		GetLoginAuthParamsBean=new GetLoginAuthParamsBean();
		GetLoginAuthParamsCall=new GetLoginAuthParamsCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(GetLoginAuthParamsCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetLoginAuthParams_001() {
		Logger.start(true,"支付宝APP快速登录请求授权成功");
		try {
			
			GetLoginAuthParamsBean.setAppId("autotest");
			GetLoginAuthParamsBean.setRequestId(TestDataManager.getRandomUUID().toString());
			GetLoginAuthParamsCall.setData(GetLoginAuthParamsBean);
			GetLoginAuthParamsCall.callService();
			Map returndata = GetLoginAuthParamsCall.getMap();
			Logger.verifyEquals("true", returndata.get("Success").toString(), "验证Success");
			Map result=(Map) returndata.get("Result");
			Logger.verifyEquals("com.alipay.account.auth", result.get("apiName").toString(), "验证apiName");
			Logger.verifyEquals("alipay.open.auth.sdk.code.get", result.get("method").toString(), "验证method");
			Logger.verifyEquals("2016022401159809", result.get("appId").toString(), "验证appId");
			Logger.verifyEquals("mc", result.get("appName").toString(), "验证appName");
			Logger.verifyEquals("openservice", result.get("bizType").toString(), "验证bizType");
			Logger.verifyEquals("2088701734809577", result.get("pId").toString(), "验证pId");
			Logger.verifyEquals("APP_FAST_LOGIN", result.get("productId").toString(), "验证productId");
			Logger.verifyEquals("kuaijie", result.get("scope").toString(), "验证scope");
			Logger.verifyNotNull(result.get("targetId"), "验证scope");
			Logger.verifyEquals("AUTHACCOUNT", result.get("authType").toString(), "验证authType");
			Logger.verifyEquals("RSA2", result.get("signType").toString(), "验证signType");
			Logger.verifyEquals("true", result.get("success").toString(), "验证success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}